from rest_framework.throttling import SimpleRateThrottle
class VisitThrottle(SimpleRateThrottle):
    """5秒内最多访问三次"""
    scope = "WD"  #settings配置文件中的key,用于获取配置的频率

    def get_cache_key(self, request, view):
        return self.get_ident(request)